package br.com.inovati.linkers.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "grupos")
public class Grupos implements Serializable {

	private static final long serialVersionUID = -25293356115172902L;

	@Id
	@Column(name = "grupo_id")
	@SequenceGenerator(name = "seq_grupo", sequenceName = "seq_grupo", allocationSize = 1)
	@GeneratedValue(generator = "seq_grupo", strategy = GenerationType.SEQUENCE)
	private Long id;

	private String grupo;
	
	@ManyToMany(mappedBy="grupo")
    private List<Telefones> telefone;
	
	@ManyToMany(mappedBy="grupo")
    private List<Emails> email;
	
	private Long fk_usuario_id;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getGrupo() {
		return grupo;
	}

	public void setGrupo(String grupo) {
		this.grupo = grupo;
	}

	public Long getFk_usuario_id() {
		return fk_usuario_id;
	}

	public void setFk_usuario_id(Long fk_usuario_id) {
		this.fk_usuario_id = fk_usuario_id;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (id ^ (id >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Grupos other = (Grupos) obj;
		if (id != other.id)
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Grupos [id=" + id + ", grupo=" + grupo + ", fk_usuario_id="
				+ fk_usuario_id + "]";
	}
}
